//===================================================================================
// $$
//
// Coder: Code Milker v1.0
// 0 - upper
// 1 - lower
//===================================================================================


namespace App.Domain.Handlers {
    using System;
    using App.Data;
    using App.Domain.Contracts;

    public class DeleteTraining {
        private readonly ITrainingRepository _TrainingRepository;

        public DeleteTraining(ITrainingRepository TrainingRepository) {
            _TrainingRepository = TrainingRepository;
        }

        public virtual void Execute(Guid trainingId) {
            var TrainingToDelete = _TrainingRepository.GetTraining(trainingId);

            if (TrainingToDelete != null) {
                _TrainingRepository.Delete(trainingId);
            }
            else {
                throw new BusinessServicesException("UnableToDeleteVehicleExceptionMessage");
            }
        }
    }
}
